 <template>
	<view v-if="pageshow">
		
		<!--主体-->
		<view class="meMain">
			<image src="../../static/user_bg.png"></image>
			<view class="mePosition">
				<view class="meMainBox">
					
					<!--头部-->
					<view class="meHead">
						<view class="meHeadAvatar">
						
					<image  :src="user.avatarUrl?user.avatarUrl:'/static/avatar.png'" mode="widthFix"></image>
								
							
						</view>
						<view class="meHeadName">
							
							<view class="userNickName" >
								<text>{{user.nickName?user.nickName:"未登录"}}</text>
								<text class="price" v-if="user.grade">{{user.grade}}{{user.class}}</text>
							</view>
							
							
						</text></view>
						
						
					</view>
					<!--头部-->
					
					<!--模板-->
				<!-- 	<view class="meOverBg">
						<view class="meVisitor">
							<view class="meVisitorLt">
								<view class="meVisitorTxt_02">￥0.00</view>
								<view class="meVisitorTxt_01">余额</view>
							</view>
							<view class="meVisitorLt">
								<view class="meVisitorTxt_02">0</view>
								<view class="meVisitorTxt_01">模板2</view>
							</view>
						</view>
					</view> -->
					<!--模板-->
					
					<!--订单-->
					<view class="meOverBg">
						<view class="meVisitorTitle" style="position: relative;">我的帖子
						 <text  class="more" @click="$u.route('/pages/user/tie')"  >查看全部</text>
						</view>
						<u-line></u-line>
						<view class="meVisitor">
							
							<u-grid :col="3" :border="false">
									<u-grid-item @click="jump('/pages/user/tie?status=1')">
										<view class="num">{{basedata.count1}}</view>
										<view class="grid-text">待审核</view>
									</u-grid-item>
									<u-grid-item @click="jump('/pages/user/tie?status=2')">
										<view class="num">{{basedata.count2}}</view>
										<view class="grid-text">已发布</view>
									</u-grid-item>
									<u-grid-item @click="jump('/pages/user/tie?status=3')">
										<view class="num">{{basedata.count3}}</view>
										<view class="grid-text">审核未通过</view>
									</u-grid-item>
								</u-grid>
						
						</view>
					</view>
					<!--订单-->
					
					<view class="meOverBg">
						<!-- <u-cell-item icon="grid" title="自助注册"   @click="$u.route('/pages/add/add')"></u-cell-item> -->
						<!-- <u-cell-item icon="order" title="我的订单" @click="$u.route('/pages/user/order')" ></u-cell-item> -->
				<!-- <u-cell-item icon="order" title="回复的帖子" @click="tel"></u-cell-item>																				
				<u-cell-item icon="heart" title="收藏的帖子" @click="tel"></u-cell-item>
													<u-cell-item icon="bookmark" title="通讯录" @click="tel"></u-cell-item>	
				<u-cell-item icon="question-circle" title="常见问题" @click="$u.route('/pages/article/list')"></u-cell-item>
				<u-cell-item icon="phone" title="联系我们" @click="tel"></u-cell-item> -->
						<u-grid :col="4" :border="false">
								<u-grid-item @click="jump('/pages/user/info')">
									<u-icon name="setting" :size="46"></u-icon>
									<view class="grid-text">个人设置</view>
								</u-grid-item>
								<u-grid-item @click="jump('/pages/user/tie')">
									<u-icon name="file-text" :size="46"></u-icon>
									<view class="grid-text">帖子</view>
								</u-grid-item>
								<u-grid-item @click="jump('/pages/user/pl')">
									<u-icon name="order" :size="46"></u-icon>
									<view class="grid-text">评论</view>
								</u-grid-item>
								<u-grid-item @click="jump('/pages/user/fav')">
									<u-icon name="heart" :size="46"></u-icon>
									<view class="grid-text">收藏</view>
								</u-grid-item>
							<!-- 	<u-grid-item>
									<u-icon name="share" :size="46"></u-icon>
									<view class="grid-text">分享</view>
								</u-grid-item> -->
								<u-grid-item @click="jumpbar('/pages/books/list')">
									<u-icon name="bookmark" :size="46"></u-icon>
									<view class="grid-text">通讯录</view>
								</u-grid-item>
								<u-grid-item @click="jump('/pages/user/ask')">
									<u-icon name="question-circle" :size="46"></u-icon>
									<view class="grid-text">常见问题</view>
								</u-grid-item>
								
								<u-grid-item @click="jump('/pages/user/company')">
									<u-icon name="phone" :size="46"></u-icon>
									<view class="grid-text">联系我们</view>
								</u-grid-item>
								
								<u-grid-item @click="trash()">
									<u-icon name="trash" :size="46"></u-icon>
									<view class="grid-text">更新缓存</view>
								</u-grid-item>
							</u-grid>									
					</view>
					<!--其他-->
					
					
					
					
					
					
				</view>
				<view class="" style="height: 25px;"></view>
			</view>
		</view>
		<!--主体-->
		<foot></foot>
		<!-- <u-tabbar v-model="current" :list="list" :mid-button="true"></u-tabbar> -->
	</view>
</template>

<script>
	export default{
		data(){
			return{
				pageshow:false,
				basedata:{},
				money:0,
				user:{},
				price:0,
				auth:false,
				avatarUrl:'../../static/icon/avatar.png',//头像
				nickName:'点击登录',
				token:'',
				loginState:'',
				valuestyle:{
					color:"#eee",
					"font-size":"12px"
				},
				list: [{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						count: 2,
						isDot: true,
						customIcon: false,
					},
					{
						iconPath: "https://cdn.uviewui.com/uview/common/min_button.png",
						selectedIconPath: "https://cdn.uviewui.com/uview/common/min_button_select.png",
						text: '自助注册',
						midButton: true,
						customIcon: false,
					},
					{
						iconPath: "file-text",
						selectedIconPath: "file-text-fill",
						text: '订单',
						customIcon: false,
					}
				],
				current: 0
			}
		},
		
		onLoad() {
			
		},
		onShow() {
			this.user=uni.getStorageSync("user")
			this.$u.post('index.php?class=user&act=basedata', {
			}).then(res => {
				this.basedata=res.data
				this.pageshow=true
			});
		},
		methods:{
			async trash(){
				if (!uni.getStorageSync("user")){
					this.msg("你还未登录");return
				}
				let a=await this.wxlogin()
				if (a.user.status==2 || a.user.status=="2"){
					this.$store.state.set.check_auth=0	  
				}else{
					this.$store.state.set.check_auth=1
				}
				this.msg("更新用户数据成功");
			},
			tel(){
				uni.makePhoneCall({
				    phoneNumber: this.webset.tel //仅为示例
				});
			},
			toorder(status){
			
				this.$u.route({
					url: 'pages/user/order',
					params: {
						current: status
					}
				})
			},
			//点击登录
			BindGetUserInfo:function(){
				if ( this.loginState == 1 ) {
					
				} else{
					let that = this;
					wx.getUserInfo({
						success: function (res) {
							//获取到的微信头像 昵称 性别
							that.nickName = res.userInfo.nickName;
							that.avatarUrl = res.userInfo.avatarUrl;
							that.loginState = 1;
						}
					});
				}
			},			
			
		}
	}
</script>

<style>
   .num{font-size: 16px; font-weight: bold; color: rgb(250, 53, 52);}
	.more{position: absolute;right: 10px; font-size: 12px; color: #888888; top: 12px;}
	.userAvatarUrl{ width: 70px; overflow:hidden; border-radius: 50%;  height: 70px;}
	 .userAvatarUrl image{width: 140rpx;}
	 .userNickName{font-size: 18px; display: flex; flex-direction: column; justify-content: center; height: 110rpx;  align-items:flex-start  }
	page{ background: #F5F5F5; }
	.meMain{ width: 100%;position: relative; background: #F1F1F1; }
	.meMain>image{ width: 100%;height: 280upx;display: block; }
	.meMainBox{ width: 96%;margin: 0 auto; }
	.mePosition{ position: absolute;top: 30px;left: 0;width: 100%; }
	.meHead{ overflow: hidden;position: relative; display: flex; align-items: center; }
	.meHeadAvatar{ float: left;width: 19%;margin-top: 10upx; }
	.meHeadAvatar image{ width: 110upx;height: 110upx;display: block;border-radius: 50%; }
	.meHeadName{ 
		display: flex; flex-direction: column; justify-items: center;
		float: left;width: 81%;height: 110upx;color: #FFFFFF;font-size: 28upx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
	
	.meOverBg{ background: #FFFFFF;overflow: hidden;border-radius: 12upx;margin-top: 25upx; }
	.meVisitor{ display: flex;flex-direction: row; }
	.meVisitorLt{ width: 50%;text-align: center;margin: 30upx 0; }
	.meVisitorLt:nth-child(1){ border-left: 1px #F5F5F5 solid;border-right: 1px #F5F5F5 solid; }
	.meVisitorTxt_01{ font-size: 28upx;color: #666666; }
	.meVisitorTxt_01 image{ width: 35upx;height: 35upx;vertical-align: middle;margin: 0 10upx 4upx 0; }
	.meVisitorTxt_02{ font-size: 30upx;color: red; }
	
	.meVisitorTitle{ font-size: 30upx;color: #333333;border-bottom: 1px #F5F5F5 solid;padding: 20upx 30upx; }
	.meOrderLt{ width: 33%;text-align: center;padding: 30upx 0;transition: all 0.4s; }
	.meOrderLt:active{ background: #E2E2E2; }
	.meOrderTxt_01{  }
	.iconmargin{margin: 0 auto 6upx;}
	.meOrderTxt_01 image{ width: 40upx;height: 40upx;display: block;margin: 0 auto 6upx; }
	.meOrderTxt_02{ font-size: 24upx;color: #666666; }
	
	.businessList{ overflow: hidden;padding: 30upx;border-bottom: 1px #F5F5F5 solid;transition: all 0.4s; }
	.businessList:active{ background: #E2E2E2; }
	.businessList:last-child{ border-bottom: none; }
	.businessListTxt{ float: left;font-size: 28upx;color: #333333; }
	.businessListTxt image{ width: 35upx;height: 35upx;vertical-align: middle;margin: 0 10upx 4upx 0; }
	.businessListYou{ float: right;font-size: 28upx;color: #333333; }
	.businessListYou image{ width: 20upx;height: 20upx;vertical-align: middle;margin: 0 0 4upx 10upx; }
	.grid-text{margin-top: 10px;}
	.price{font-size: 12px;  margin-top: 10rpx;}
	
</style>
